Repository navigation
fix(reassembly): a datagram too long for its length field never completes (#1585) - #1598
Merged
Merged
Conversation
…etes (#1585) - A datagram's length was bounded by the 65,535-octet data buffer alone, so an IPv4 one whose 20-octet header and 65,523 octets of data make 65,543 read COMPLETE. IP._is_complete now bounds it by 65,535 octets with its header, as a new IP._header_overhead counts it: all of it for IPv4's Total Length, and for IPv6's Payload Length (IPv6 override) all but the fixed 40-octet header. - A Total Length of 0 declares no length (#1555), so a fragment whose header and data outgrow that grows the buffer past 65,535 octets, which lifts the bound. Growth is otherwise unchanged. - The _detect_conflicts docstring said a non-final fragment's range is always block-aligned. It now documents that a cut, truncated or clipped fragment's unmarked partial block is not compared, deliberately; the Datagram.conflict comment and the ipv4/ipv6 conflict notes say the same. - The IP reassembly docs list the bound as a third departure from RFC 791. - A #1565 pin asserted that an IPv4 final fragment at offset 65,528 completes; that is the defect, so the pin is now IPv6 only. Sample-capture reassembly is unchanged (7,998 rows, default/dpkt/scapy).
Owner
Author
|
Verdict: GOOD TO GO at
Non-blocking corner: a first fragment with options (IHL 60, real Total Length) followed by a TL=0 final fragment at IHL 20, with TDL 65,500, reads PARTIAL; on |
Contributor
|
Coverage: 89.70% (unit tier, Python 3.14,
Per-file detail: the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Please follow the guide below
You will be asked some questions, please read them carefully and answer honestly
Put an
xinto all the boxes [ ] relevant to your pull request (like that [x])Use Preview tab to see how your pull request will actually look like
Searched for similar pull requests
Followed the coding style (
make pylint,make mypy,make isort)make testpasses, and a test case covers the changeAdded a changelog entry under
docs/source/changelog/and regeneratedCHANGELOG.md, if the change is user-visible — N/A — centralised in docs(changelog): shared 1.5.0 changelog — long-lived, merges last (#610, #616, #617, #618, #620) #657What is the purpose of your pull request?
Tick the commit type your subject line carries.
fix— corrects a defectfeat— adds a featureperf— changes performance, not behaviourrefactor— changes neither behaviour nor performancetest— tests onlydocs— documentation onlyci— workflows or build toolingrelease— bumps the version or rolls up a distributionchore— anything elseDescription of your pull request and other information
Closes #1585. The code change is in
pcapkit/foundation/reassembly/ip.pyandipv6.py; the docs underdocs/source/pcapkit/foundation/reassembly/ip/and theDatagram.conflictcomment are brought in line.IP._is_completenow bounds a datagram at 65,535 octets with its header, as the newIP._header_overheadcounts it. IPv4's Total Length counts the whole header. IPv6's Payload Length counts every header except the fixed 40 octets, soipv6.pyoverrides the hook. The issue's case 3c (20 + 65,523) now readsPARTIALwith every octet still reported. IPv6 with no extension header still completes at 65,535 octets of data._detect_conflictsdocstring. It now says that octets in an unmarked partial block are deliberately not compared (fix(reassembly): IPv6 reassembly zero-fills a snaplen-cut non-final fragment and reports it COMPLETE #1567). A new test pins this. TheDatagram.conflictcomment and the conflict notes inipv4.rstandipv6.rsthad the same stale claim, and now say the same.ip/index.rstlists the bound, with the Total Length 0 exemption, as a third departure from RFC 791.The default, dpkt and scapy engines agree on crafted IPv4/IPv6 captures. Sample-capture reassembly is byte-identical to
main: 7,998 rows across those engines, in both modes.